In this tutorial, you can find a comprehensive guideline on how to convert a PHP array to JavaScript accurately. Just check out the options and examples.
This short tutorial will represent to you the most effective way of returning JSON from a PHP script.